<?php 
   $sql = "SELECT * FROM category";
   $db =  Yii::app()->db;   
   $cmd = $db->createCommand($sql);
   $categories = $cmd->queryAll();
   
   $controllerName = Yii::app()->controller->id;
   $actionName = Yii::app()->controller->action->id;
   
?>
<ul id="yw0">
   <li id="menu-item" class="<?if($controllerName == 'site' && $actionName == 'index') echo 'active'?>"><a href="<?php echo Yii::app()->homeUrl?>">Trang chủ</a></li>
   <li id="menu-item" class="<?if($controllerName == 'about') echo 'active'?>"><a href="/about/">Giới thiệu</a></li>
   <li id="menu-item" class="<?if($controllerName == 'category') echo 'active'?>"><a href="/category">Chuyên mục</a>
   <ul>
      <?php foreach($categories as $item){
      $link = Yii::app()->request->hostInfo . '/category/'.$item['cat_id'] . '/' . CVietnameseTools::makeUrlFriendly($item['cat_name']) . '/';
      ?>
         <li class=""><a href="<?php echo $link?>"><?php echo $item['cat_name']?></a></li>
      <?php }?>
   </ul>
   </li>
   <li id="menu-item" class="<?if($controllerName == 'news') echo 'active'?>"><a href="/news/">Tin tức</a></li>
   <li id="menu-item" class="<?if($controllerName == 'site' && $actionName == 'contact') echo 'active'?>"><a href="/site/contact">Liên hệ</a></li>
</ul>
<div class="right relative">
   <form id="search-header" class="pull-right" method="get" action="<?php echo Yii::app()->request->hostInfo?>/search" accept-charset="utf-8">
      <input type="text" name="t" class="search-form_it" placeholder="Tìm kiếm" />
      
      <input type="submit" value="Go" id="search-form_is" class="search-form_is sprite" />
   </form>
</div>